package com.example.qa.service.application.service;

import com.example.qa.service.application.command.CreateqaCommand;
import com.example.qa.service.application.port.in.CreateqaUseCase;
import com.example.qa.service.domain.qa;
import com.example.qa.service.domain.port.CreateqaPort;
import com.example.qa.service.domain.valueobject.Email;
import com.example.qa.service.domain.valueobject.qaAge;
import com.example.qa.service.domain.valueobject.qaName;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class CreateqaService implements CreateqaUseCase {
    @Resource
    private CreateqaPort createqaPort;
    @Override
    public qa createqa(CreateqaCommand createqaCommand) {
        //command -> domain
        qa qa=new qa(
                new qaName(createqaCommand.name()),
                new qaAge(createqaCommand.age()),
                new Email(createqaCommand.email())
        );
        log.info("qa:{}",qa);
        return createqaPort.createqa(qa);
    }
}
